import request from '@/utils/request';

// 根据 ID 获取员工信息
export function getEmployeeById(id) {
  return request({
    url: `/admin/employee/${id}`,
    method: 'get'
  });
}

// 员工退出接口
export function employeeLogout() {
  return request({
    url: '/admin/employee/logout',
    method: 'post'
  });
}

// 编辑员工信息
export function updateEmployee(data) {
  return request({
    url: '/admin/employee',
    method: 'put',
    data
  });
}

// 新增员工
export function addEmployee(data) {
  return request({
    url: '/admin/employee',
    method: 'post',
    data
  });
}

// 员工分页查询
export function getEmployeePage(params) {
  return request({
    url: '/admin/employee/page',
    method: 'get',
    params
  });
}

// 删除员工
export function deleteEmployee(id) {
  return request({
    url: `/admin/employee/${id}`,
    method: 'delete'
  });
}

// 设置员工权限
export function setEmployeeRole(id, role) {
  return request({
    url: `/admin/employee/setRole/${id}`,
    method: 'put',
    params: { role }
  });
}